//----------------------------------------------------------------------------
//Borland C++Builder
//Copyright (c) 1987, 1998 Borland International Inc. All Rights Reserved.
//----------------------------------------------------------------------------
//----------------------------------------------------------------------------
#ifndef aboutH
#define aboutH
//----------------------------------------------------------------------------
#include <System.hpp>
#include <Windows.hpp>
#include <SysUtils.hpp>
#include <Classes.hpp>
#include <Graphics.hpp>
#include <Forms.hpp>
#include <Controls.hpp>
#include <StdCtrls.hpp>
#include <Buttons.hpp>
#include <ExtCtrls.hpp>
#include <IniFiles.hpp>
#include "CUrlLbl.h"
#include "uEtat.h"
#include "CBitBtn.h"
//----------------------------------------------------------------------------
class  TAboutBox : public TForm
{
__published:
    TImage *ProgramIcon;
    TLabel *Comments;
    CUrlLabel *UrlTechnique;
    TLabel *lblTechnique;
    TLabel *LblCommercial;
    CUrlLabel *UrlCommercial;
    CUrlLabel *UrlSite;
    TLabel *lblSite;
    TLabel *CompagnyName;
    TLabel *Label1;
    TLabel *ProductName;
    TLabel *Version;
    TPanel *toto;
    CBitBtn *OKButton;
	void __fastcall OKButtonClick(TObject *Sender);

private:

    static char s_viRootStr[];
    static char s_viTransStr[];
    static char s_viSubBlockQueryFmt[];
    static char s_viSpecialBuildStr[];

    TIniFile              *m_CaracPartenaire;
    void*                  m_Buff;       // new'd File version info buffer
    unsigned int           m_Lang;       // Default language translation
    VS_FIXEDFILEINFO*      m_FixedInfo;  // Fixed file info structure
    HINSTANCE              m_HInstModule;
    HWND                   m_hComment;
    inline unsigned int   MkUINT(unsigned short lo, unsigned short hi)  {  return lo | ((unsigned int)(hi) << 16); };
    inline unsigned short HiUSHORT(unsigned int u32)                    {  return (unsigned short)(u32 >> 16);};
    inline unsigned short LoUSHORT(unsigned int u32)                    {  return (unsigned short)(u32);};

    bool __fastcall Init(const char* modFName);
    bool __fastcall GetInfoString(const AnsiString& str, AnsiString& value, unsigned int lang=0);
    void __fastcall WMNotify     ( TWMNotify            &Msg);

  BEGIN_MESSAGE_MAP
   MESSAGE_HANDLER(WM_NOTIFY, TWMNotify, WMNotify)
  END_MESSAGE_MAP(TForm)

public:
    // TFileOS values are returned by GetFileOS()
    enum TFileOS { OSUnknown    = VOS_UNKNOWN,
                   DOS          = VOS_DOS,
                   OS216        = VOS_OS216,
                   OS232        = VOS_OS232,
                   NT           = VOS_NT,
                   Windows16    = VOS__WINDOWS16,
                   PM16         = VOS__PM16,
                   PM32         = VOS__PM32,
                   Windows32    = VOS__WINDOWS32,
                   DosWindows16 = VOS_DOS_WINDOWS16,
                   DosWindows32 = VOS_DOS_WINDOWS32,
                   OS216PM16    = VOS_OS216_PM16,
                   OS232PM32    = VOS_OS232_PM32,
                   NTWindows32  = VOS_NT_WINDOWS32
    };
    // TFileType is returned by GetFileType()
    enum TFileType { TypeUnknown = VFT_UNKNOWN,
                     App         = VFT_APP,
                     DLL         = VFT_DLL,
                     DevDriver   = VFT_DRV,
                     Font        = VFT_FONT,
                     VirtDevice  = VFT_VXD,
                     StaticLib   = VFT_STATIC_LIB
    };
    // TFileSubType values are returned by GetFileSubType() if GetFileType
    // returned DevDriver or Font
    enum TFileSubType { UnknownDevDriver,  //VFT2_UNKNOWN
                        PtrDriver,         //VFT2_DRV_PRINTER
                        KybdDriver,        //VFT2_DRV_KEYBOARD
                        LangDriver,        //VFT2_DRV_LANGUAGE
                        DisplayDriver,     //VFT2_DRV_DISPLAY
                        MouseDriver,       //VFT2_DRV_MOUSE
                        NtwkDriver,        //VFT2_DRV_NETWORK
                        SysDriver,         //VFT2_DRV_SYSTEM
                        InstallableDriver, //VFT2_DRV_INSTALLABLE
                        SoundDriver,       //VFT2_DRV_SOUND
                        UnknownFont,       //VFT2_UNKNOWN
                        RasterFont,        //VFT2_FONT_RASTER
                        VectorFont,        //VFT2_FONT_VECTOR
                        TrueTypeFont       //VFT2_FONT_TRUETYPE
    };

    unsigned int  __fastcall GetSignature() const                      { return m_FixedInfo->dwSignature;};
    unsigned int  __fastcall GetStrucVersion() const                   { return m_FixedInfo->dwStrucVersion;    };
    unsigned int  __fastcall GetFileVersionMS() const                  { return m_FixedInfo->dwFileVersionMS;   };
    unsigned int  __fastcall GetFileVersionLS() const                  { return m_FixedInfo->dwFileVersionLS;   };
    unsigned int  __fastcall GetProductVersionMS() const               { return m_FixedInfo->dwProductVersionMS;};
    unsigned int  __fastcall GetProductVersionLS() const               { return m_FixedInfo->dwProductVersionLS;};
    bool          __fastcall IsFileFlagSet(unsigned int flag) const    { return ((m_FixedInfo->dwFileFlags & m_FixedInfo->dwFileFlagsMask) & flag);};
    unsigned int  __fastcall GetFileFlagsMask() const                  { return m_FixedInfo->dwFileFlagsMask;};
    unsigned int  __fastcall GetFileFlags() const                      { return m_FixedInfo->dwFileFlags;};
    bool          __fastcall IsDebug() const                           { return IsFileFlagSet( VS_FF_DEBUG);};
    bool          __fastcall InfoInferred() const                      { return IsFileFlagSet( VS_FF_INFOINFERRED);};
    bool          __fastcall IsPatched() const                         { return IsFileFlagSet( VS_FF_PATCHED);};
    bool          __fastcall IsPreRelease() const                      { return IsFileFlagSet( VS_FF_PRERELEASE);};
    bool          __fastcall IsPrivateBuild() const                    { return IsFileFlagSet( VS_FF_PRIVATEBUILD);};
    bool          __fastcall IsSpecialBuild() const                    { return IsFileFlagSet( VS_FF_SPECIALBUILD);};
    unsigned int  __fastcall GetFileOS() const                         { return m_FixedInfo->dwFileOS;};  // returns TFileOS values
    unsigned int  __fastcall GetFileType() const                       { return m_FixedInfo->dwFileType;};
    unsigned int  __fastcall GetFileSubType() const;
    FILETIME      __fastcall GetFileDate() const;


    bool __fastcall GetFileDescription(  AnsiString& fileDesc,         unsigned int lang=0);
    bool __fastcall GetFileVersion(      AnsiString& fileVersion,      unsigned int lang=0);
    bool __fastcall GetInternalName(     AnsiString& internalName,     unsigned int lang=0);
    bool __fastcall GetLegalCopyright(   AnsiString& copyright,        unsigned int lang=0);
    bool __fastcall GetOriginalFilename( AnsiString& originalFilename, unsigned int lang=0);
    bool __fastcall GetProductName(      AnsiString& prodName,         unsigned int lang=0);
    bool __fastcall GetCompagnyName(     AnsiString& CompagnyName,     unsigned int lang=0);
    bool __fastcall GetProductVersion(   AnsiString& prodVersion,      unsigned int lang=0);
    bool __fastcall GetSpecialBuild(     AnsiString& debug,            unsigned int lang=0);
    bool __fastcall GetComments(         AnsiString& Comment,          unsigned int lang=0);
    bool __fastcall GetUrlSite(          AnsiString& Url,              unsigned int lang=0);
    bool __fastcall GetUrl(              AnsiString& Url, AnsiString& Mail, bool bCommercial, unsigned int lang=0);
    #define GetUrlCommercial( Url, Mail) GetUrl( Url, Mail, true,  m_Lang)
    #define GetUrlTechnique(  Url, Mail) GetUrl( Url, Mail, false, m_Lang)

    unsigned int  __fastcall GetLanguage() const;
    AnsiString    __fastcall GetLanguageName(unsigned int language);

    void __fastcall SetInstModule( char *modFName);

	   __fastcall TAboutBox(TComponent* AOwner);
    virtual __fastcall ~TAboutBox();
};

void __fastcall ETATAPI EditAboutBox(TComponent* AOwner, const AnsiString &Name);
//----------------------------------------------------------------------------
#endif
